<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>职位管理</title>
    <link rel="stylesheet" href="assets/css/layui.css">
    <link rel="stylesheet" href="assets/css/view.css"/>
    <link rel="stylesheet" href="assets/css/admin.css"/>
    <link rel="stylesheet" href="assets/css/style.css"/>
    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
    <style type="text/css">
        .layui-form-item{ margin-bottom: 0;}
    </style>
    <script>
        /*页面刷新函数*/
        function refresh(){
            var id = ${sessionScope.pageUser.id};
            $.get("ManagerServlet?param=studentInfo",function (jsonArray){
                $("#tbody").empty();
                $(jsonArray).each(function (){
                    var sId = this.sId;
                    var sName = this.sName;
                    var sSex = this.sSex;
                    var sSpeciality = this.sSpeciality;
                    var sDepartment = this.sDepartment;
                    var sEnrollYear = this.sEnrollYear;
                    var clName = this.clName;
                    $("#tbody").append("<tr>" +
                        "<td>" +sId + "</td>"+
                        "<td>" + sName+ "</td>"+
                        "<td>" + sSex+ "</td>"+
                        "<td>" + sSpeciality+ "</td>"+
                        "<td>" + sDepartment+ "</td>"+
                        "<td>" + sEnrollYear+ "</td>"+
                        "<td>" + clName+ "</td>"+
                        "<td>" +
                            "<button class='layui-btn layui-btn-normal layui-btn-xs' >修改</button>" +
                            "<button class='layui-btn layui-btn-danger layui-btn-xs delete' onclick='isDelete("+sId+")'>删除</button>" +
                            "</div>\n" +
                        "</td>"+
                        "</tr>");
                })
            },"json")
        }
        function isDelete(id){
            //删除提醒的提示框
            var result = window.confirm("确认删除吗？")
            if(result){
                window.location.href = "ManagerServlet?param=studentDelete&id="+id;
            }else{

            }
        }
        $(function(){
            refresh();
        });
    </script>
</head>
    <body class="layui-view-body">
    <div class="layui-content">
        <!--面包屑导航-->
        <div class="mianb">
            <div class="mblf layui-col-xs6 layui-col-md6">
                <i class="layui-icon">&#xe656;</i>
                <p>学生信息管理 > <span>查看学生信息</span></p>
            </div>
            <div class="mbrt layui-col-xs6 layui-col-md6">
                <a href="manager_student_add.jsp" class="layui-btn layui-btn-normal">添加学生信息</a>
            </div>
        </div>
        <!--面包屑导航-->
        <div class="layui-row">
            <div class="layui-card">
                <div class="table-responsive">
                    <table class="layui-table" lay-skin="line" lay-size="lg" id="table">
                        <tr>
                            <th>学号</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>专业</th>
                            <th>院系</th>
                            <th>入学年份</th>
                            <th>班级</th>
                            <th>操作</th>
                        </tr>
                        <tbody id="tbody">
                            <%--将信息加进去--%>
                        </tbody>
                    </table>
                </div>
                <!--分页-->
                <div id="page"></div>
                <!--分页-->
            </div>
        </div>
    </div>
    <script src="assets/layui.all.js"></script>

    </body>
</html>